/**
 * @(#) AppmssProxy.as
 *
 * @date		2011. 03. 25
 * @version		1.0
 * @author		baek kwang hyoun
 * @description	평가결과 Proxy - Proxy
 */
package com.skt.common_hr.empcont.model
{
	import com.skt.common_hr.common.Variables;
	import com.skt.common_hr.common.puremvc.CommonProxy;
	import com.skt.common_hr.empcont.model.vo.mainListVO;
	import com.wcl.dataloader.*;
	
	import mx.collections.ArrayCollection;
	import mx.controls.Alert;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;

	public class CompanyProxy extends CommonProxy
	{
		public static const NAME:String = "CompanyProxy";




		/**
		 * 생성자
		 *
		 * @param
		 * @return void
		 */
		public function CompanyProxy(data:Object=null)
		{
			super(NAME, data);
		}

		
		public function saveSend(vo:mainListVO, setFunc:Function):void
		{
			var tables:Object = new Object();
			var obj:Object = {};
			obj.I_PERNR = Variables.myPernr;
			obj.I_ECODE = vo.ECODE;


			var table:Array = new Array();			
			var obj2:Object = {};
			obj2.CYES = "X";
			table.push(obj2);
			
			tables["ITAB"] = table;

			saveData("Z_HR_EC03", obj, tables, saveResult, saveFault, setFunc);
		}

		public function saveResult(event:ResultEvent):void
		{
			if(retCode==0) {				
				event.result.func();
			}
			else {
				Alert.show(retText);
			}
		}
		
		private function saveFault(event:FaultEvent):void
		{
			Alert.show('HthIcProxy.as listFault err: ' + retText);
		}
		
		private function parseSave(recArr:ArrayCollection):ArrayCollection
		{
			var retArr:ArrayCollection = new ArrayCollection();

			for each(var rec:Object in recArr) 
			{
				var vo:mainListVO = new mainListVO();
				vo.ADDR			= rec["ADDR"];
				vo.BEGDA		= rec["BEGDA"];	
				vo.CDATE		= rec["CDATE"];
				vo.CYES			= rec["CYES"];
				vo.ECODE		= rec["ECODE"];
				vo.ENAME		= rec["ENAME"];
				vo.ENDDA		= rec["ENDDA"];
				vo.ETEXT		= rec["ETEXT"];
				vo.PERNR		= rec["PERNR"];
				vo.PYES			= rec["PYES"];
				vo.REGNO		= rec["REGNO"];
				vo.SEQNR		= rec["SEQNR"];
				
				retArr.addItem(vo);
			}
			return retArr;
		}
	
	}		
}